const render = require('koa-art-template');
const path = require("path");
const requireDir = require("require-directory");
const Router = require("koa-router")
function initProject(app){
    requireDir(module,"../routers",{visit:loadRoutes})
    render(app, {
        root: path.join(process.cwd(), 'pages'),
        extname: '.html',
        debug: process.env.NODE_ENV !== 'production'
    });
    function loadRoutes(obj){
        // console.log(obj instanceof Router);
        if(obj instanceof Router){
            app.use(obj.routes());
        }
    }
}

module.exports = initProject